import request from '@/utils/request'
import type { LoginRequest, RegisterRequest, UserInfo, Result } from '@/types/user'

export const userApi = {
  login(data: LoginRequest) {
    return request.post<Result<string>>('/api/user/login', data)
  },

  register(data: RegisterRequest) {
    return request.post<Result<string>>('/api/user/register', data)
  },

  getUserInfo() {
    return request.get<Result<UserInfo>>('/api/user/info')
  },

  logout() {
    return request.post<Result<void>>('/api/user/logout')
  }
} 